package de.hwrBerlin.dataMining.controller.observer;

import java.util.ArrayList;
import java.util.List;

import de.hwrBerlin.dataMining.dataStructure.TableData;
import de.hwrBerlin.dataMining.dataStructure.TreeNode;

public abstract class Subject {

    private List<Observer> _observer = new ArrayList<Observer>();

    public void addObserver(Observer pObserver) {
        _observer.add(pObserver);
    }

    public void removeObserver(Observer pObserver) {
        _observer.remove(pObserver);
    }

    public void updateAllTable(TableData pTableData) {
        for (Observer observer : _observer) {
            observer.updateAllTable(pTableData);
        }
    }

    public void updatetAllTree(TreeNode pTree) {
        for (Observer observer : _observer) {
            observer.updateTree(pTree);
        }
    }

    public void updateAllInteractiveTree(TreeNode pTree) {
        for (Observer observer : _observer) {
            observer.updateAllInteractiveTree(pTree);
        }
    }

    public void updateAllAutomaticTree(TreeNode pTree) {
        for (Observer observer : _observer) {
            observer.updateAllAutomaticTree(pTree);
        }
    }

}
